package designpattern.proxy.cglib;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author zhangxin
 * @date 2020/10/29
 */
public class ServiceInterceptor implements MethodInterceptor {


    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("cglib 方法执行前");
        Object invoke = methodProxy.invokeSuper(o, objects);
        System.out.println("cglib 方法执行后");
        return invoke;
    }
}
